<?php
header('Content-type: text/html; charset=utf-8');
include ('conn/conn.php');
if (isset($_POST["submit"])){
	$name = $_POST["td_name"];
	$pwd = $_POST["td_pwd"];
	if ($name=="" || $name == null || $pwd == "" || $pwd == null){
		echo "<script type=\"text/javascript\">alert('信息不能为空,请重新填写！');history.back();</script>";
	}else {
		$sql = mysql_query("insert into tb_admin (name,pwd) values ('$name','$pwd')");
		if ($sql){
			echo "<script type=\"text/javascript\">alert('恭喜，用户添加成功!');window.location.href='user_manage.php';</script>";
		}else {
			echo "<script type=\"text/javascript\">alert('用户添加失败！');window.location.href='user_add.php';</script>";
		}
	}
	
}
mysql_close();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="templets/css/common.css" type="text/css" />
<title>文章分类</title>
</head>

<body>
<div id="man_zone">	
	<form action="" method="post">
		<table width="99%" border="0" align="center"  cellpadding="1" cellspacing="0" class="table_style">
    		<tr>
      			<td width="18%" class="left_title_1 nos"><span class="left-title">用户名：</span></td>
      			<td width="82%" class="nos"><input type="text" name="td_name" /></td>
    		</tr>
    		<tr>
      			<td width="18%" class="left_title_1 nos"><span class="left-title">密码：</span></td>
      			<td width="82%" class="nos"><input type="text" name="td_pwd" /></td>
    		</tr>
    		<tr>
				<td colspan="2" align="right" class="nos"><input type="submit" name="submit" value="提交" /><input type="reset" value="重置" 、></td>
			</tr>
		</table>
	</form>
</div>
</body>
</html>